{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}

    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>轮播图</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('Index/index')}">主页</a>
                    </li>
                    <li>
                        <a>设置</a>
                    </li>
                    <li>
                        <strong>轮播设置</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>轮播图片列表</h5>
                            <div class="ibox-tools">
                                <small>共 {$Count} 条</small>
                            </div>
                        </div>

                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <a href="javascript:;" onclick="banner_add('添加轮播图','{:url("System/BannerAdd")}','800','428')" class="btn btn-sm btn-primary"> 添加轮播图</a>
                                    </div>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>轮播图片</th>
                                        <th>轮播位置</th>
                                        <th>链接地址</th>
                                        <th>顺序</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="BannerList" id="v"}
                                    <tr>
                                        <td>{$key+1}</td>
                                        <td><img src="{$v.url}" style="max-width: 100px"></td>
                                        <td>
                                            {if condition="$v.place eq 1"}商城首页
                                            {elseif condition="$v.place eq 2"/}注册登录页
                                            {elseif condition="$v.place eq 3"/}搜索结果页
                                            {elseif condition="$v.place eq 4"/}系统首页
                                            {/if}
                                        </td>
                                        <td>{$v.dizhi}</td>
                                        <td>{$v.xu}</td>
                                        <td>
                                            <a title="轮播图片删除" href="javascript:;" class="btn btn-xs btn-danger" onClick="banner_del(this,{$v.id})">删除</a>
                                            <a title="轮播图片编辑" href="javascript:;" class="btn btn-xs btn-primary" onclick="banner_add('编辑轮播图','{:url("System/BannerEdit",['id'=>$v.id])}','800','428')">编辑</a>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}
    </div>
</div>
</div>

{include file="public/footer"}

<script>

    /*轮播-增加*/
    function banner_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*轮播-增加*/
    function banner_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*等级-删除*/
    function banner_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('System/BannerDelete')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }
</script>
</body>

</html>
